package org.xyl.game.controller;

import cn.hutool.core.lang.hash.Hash;
import com.google.gson.Gson;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.xyl.game.service.MapgameService;
import org.xyl.game.tool.GsonUtil;

import java.util.HashMap;
import java.util.Map;

@Controller
public class MapGameController {

    @Autowired
    public MapgameService mapgameService;
    @PostMapping("/signmap")
    @ResponseBody
    public String signMap(int id, String username, int block){
        boolean b = mapgameService.signMap(id, username, block);
        Map<String,String>  ansMap=new HashMap<>();
        if(b){
            ansMap.put("state","success");
        }else{
            ansMap.put("state","fail");
        }
        return GsonUtil.getGsonBuilder().create().toJson(ansMap);
    }
}
